Messstellen für das Monitoring 2018
Wed, Oct 4, 2017Auswahlkriterien
- kleiner 30km² (0.46- 29.94) Einzugsgebietsfläche
- grrößer 40% (0.4 - 0.98) Landwirtschaft
- keine Kläranlage
Anzahl der zukünftigen Probestellen pro Bundesland
| BL | Bundesland | ATKIS_LAWI% | ALVBERICHT_LAWI% | KS% | MST_380 | MST_190 |
|---|---|---|---|---|---|---|
| BW | Baden-Württemberg | 7.5 | 6.9 | 13.0 | 28 | 14 |
| BY | Bayern | 17.9 | 17.6 | 15.5 | 68 | 34 |
| BB | Brandenburg | 8.4 | 8.6 | 3.0 | 32 | 16 |
| HE | Hessen | 4.6 | 4.0 | 7.4 | 17 | 9 |
| MV | Mecklenburg-Vorpommern | 8.1 | 9.1 | 2.0 | 31 | 16 |
| NI | Niedersachsen | 14.7 | 15.8 | 9.3 | 56 | 28 |
| NW | Nordrhein-Westfalen | 9.2 | 9.0 | 21.1 | 35 | 18 |
| RP | Rheinland-Pfalz | 3.9 | 3.5 | 4.8 | 15 | 8 |
| SL | Saarland | 0.4 | 0.3 | 1.2 | 2 | 1 |
| SN | Sachsen | 5.5 | 6.0 | 5.1 | 21 | 11 |
| ST | Sachsen-Anhalt | 8.2 | 8.4 | 2.8 | 31 | 16 |
| SH | Schleswig-Holstein | 6.5 | 5.6 | 3.4 | 25 | 13 |
| TH | Thüringen | 5.0 | 5.2 | 2.7 | 19 | 10 |
Verteilung der Einzugsgebiete nach dem Anteil an Landwirtschaft und der Einzugsgebietsgröße.


## Verschneiden mit WWTP_2000 layer (v. Sebastian Maassen, Jörg Rechenberg (UBA) erhalten)
test = ezg[-unlist(st_intersects(ezg, wwtp)),]
mapview(test)
class(test)
mapview(ezg)
st_crs(ezg) = st_crs(wwtp)
Zufällige Auswahl von Messstellen pro Bundesland
Ausgehend von der benötigten Anzahl an Messstellen pro Bundesland werden einmal zufällige Messstellen in jedem Bundesland gezogen und ein weiters Mal Messstellen mit einer Gewichtung hinsichtlich der Einzugsgebiestgröße gezogen.
Verteilung der zufällig gezogenen Messstellen
Die Verteilung des Anteils an landwirtschaflticher Fläche ähnelt der Gesamtverteilung.
## Random sampling
setDT(ezg_dt)
site_state2 = site_state[site_state$BL != 'SL', ] # keine EZG im Saarland
ns = setNames(site_state2$MST_190, site_state2$BL)
set.seed(12345678)
s1 = ezg_dt[ezg_dt[ ,
sample(x = .I,
size = ns[ match(unlist(.BY), names(ns)) ],
replace = FALSE),
by = 'state']$V1, ]


Verteilung der mit unterschiedlichen Wahrscheinlichkeiten gezogenen Messstellen
Da vermutet wird, dass mit absteigender EZG-Größe die Anzahl der EZG steigt, werden kleine EZG bei der Ziehung stärker gewichtet.
Messstellen nahe Landau
Catchments in a 50km circumference of Landau
# German cities
if (online) {
drv = dbDriver('PostgreSQL')
con = dbConnect(drv, user = DBuser, dbname = DBname_1, host = DBhost, port = DBport, password = DBpassword)
# Why is it so slow???!! https://github.com/r-spatial/sf/issues/503
#pl = st_read_db(con, query = "SELECT * FROM spatial_derived.germany_places")
pl = get_postgis_query(con, "SELECT * FROM spatial_derived.germany_places WHERE name ILIKE 'Landau%'", geom_name = 'geom')
pl = st_as_sf(pl)
invisible(dbDisconnect(con))
invisible(dbUnloadDriver(drv))
saveRDS(pl, file.path(cachedir, 'places_germany.rds'))
} else {
pl = readRDS(file.path(cachedir, 'places_germany.rds'))
}
# grep Ladau
ld = pl[grep('Landau.+Pfalz', pl$name), ]
# Intersect catchments in a 50km circumference of Landau
st_crs(ld) = st_crs(ezg) #! p4s not matching 100%, change this in DB
## Warning: st_crs<- : replacing crs does not reproject data; use st_transform
## for that
ezg_ld_50 = ezg[unlist(st_intersects(st_buffer(ld, 50000), ezg)), ]
# interactive table
datatable(as.data.frame(ezg_ld_50)[ ,-7], caption = 'Catchments in a 50km circumference of Landau')
Auswahl um Landau
# manual selection
ezg_ld = c('RP_2375895800', 'RP_2378897000', 'RP_2391899300', 'BW_KR019.00')
# plot intersection area and all RP catchments
mapview(st_buffer(ld, 50000), color = 'goldenrod', lwd = 2, alpha.regions = 0,
map.type = 'Esri.WorldImagery') +
mapview(ezg[ezg$state %in% c('BW', 'HE', 'RP'), ], alpha.regions = 0.2, layer.name = 'EZG in BW, HE, RP') +
mapview(ezg[ezg$site_id %in% ezg_ld, ], color = 'red', lwd = 3, layer.name = 'ausgewählte EZG')
datatable(as.data.frame(ezg)[ezg$site_id %in% ezg_ld, -7])
## Random sampling with probabilities
# thanks to
# https://stackoverflow.com/questions/17001808/generate-random-integers-between-two-values-with-a-given-probability-using-r
# ???
sample_list = list()
for (i in 1:length(names(ns))) {
st = names(ns)[i]
ezg_state = ezg_dt[ ezg_dt$state == st ]
I1 = ezg_state[ , .I[area_sqkm <= 5]]
I2 = ezg_state[ , .I[area_sqkm > 5 & area_sqkm <= 10]]
I3 = ezg_state[ , .I[area_sqkm > 10 & area_sqkm <= 15]]
I4 = ezg_state[ , .I[area_sqkm > 15 & area_sqkm <= 25]]
I5 = ezg_state[ , .I[area_sqkm > 25 & area_sqkm <= 30]]
L = sapply(list(I1, I2, I3, I4, I5), length); L
set.seed(12345678)
s2 = ezg_state[ezg_state[ ,
sample(x = c(I1, I2, I3, I4, I5),
size = ns[ match(unlist(.BY), names(ns)) ],
prob = rep(c(1/1.5, 1/4, 1/6, 1/9, 1/12) / L, L),
replace = FALSE),
by = state]$V1, ]
sample_list[[i]] = data.table(s2)
names(sample_list)[i] = st
}
## include manually picked EZGs close to Landau
manual_sel = as.data.table(ezg)[ ezg$site_id %in% ezg_ld, ][ , geometry := NULL ]
sample_list[['RP']][ site_id %in% c('RP_2397891300', 'RP_2375831900', 'RP_2522891900', 'RP_2699896100') ] = manual_sel
sample_dt = rbindlist(sample_list)


Karte der ausgewählten Einzugsgebiete
## Writing layer `ezg_ukl' to data source `/home/andreas/Desktop/ezg_ukl.shp' using driver `ESRI Shapefile'
## features: 2593
## fields: 6
## geometry type: Multi Polygon
## site_id site state source area_sqkm atkis_perc
## 1: SH_123755 mzb SH image delineation 19.7 0.78
## 2: NI_37432228 mzb NI image delineation 5.9 0.88
## 3: NI_48972700 mzb NI image delineation 9.0 0.63
## 4: SH_126643 mzb SH image delineation 7.9 0.47
## 5: NI_48862918 mzb NI image delineation 10.0 0.91
## ---
## 2589: ST_413719 psm ST DEM 28.3 0.82
## 2590: TH_2227 psm TH DEM 19.8 0.82
## 2591: TH_2546 psm TH DEM 29.9 0.51
## 2592: TH_4058 psm TH DEM 18.7 0.55
## 2593: SN_OBF58002 psm SN DEM 28.2 0.73
Weitere (noch nicht beachtete) Auswahlkriterien
- Handynetz
- Abstand zwischen den Einzugsgebieten
- Kläranlagen